package jou.cs.service;

import jou.cs.entity.TAns;
import jou.cs.entity.TQus;
import org.springframework.data.domain.Page;

import java.util.List;
import java.util.Map;

public interface QuestionService {
    //add
    public void addQuestion(TQus question);
    //delete by id
    public void deleteQuestion(Long qid);
    //update
    public void updateQuestion(TQus question);
    //get question by id
    public TQus getQuestionById(Long qid);

    //page query
    public Page<TQus> getQuestionByPage(int page);

    //get question by user id
    public List<Map<Object, Object>> getQuestionByUserId(Long uid);

    //get question by user id and page
    public Page<TQus> getQuestionByUserIdAndPage(Long uid, int page);

    //给当前问题添加回答
    public void addAnswer(Long qusId, TAns ans);

    //获取当前问题的所有回答
    public List<TAns> getAnsByQusId(Long qusId);

    //获取当前问题的所有回答，并分页
    public Page<TAns> getAnsByQusIdAndPage(Long qusId, int page);

    // 删除回答
    public void deleteAns(Long id);

    List<Map<Object, Object>> getQusByPid(Long pid);

}
